-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔍 Make document outline collapsible #373
Conversation
c2ce2f3
to
6f78f60
Compare
👍🏼 cool - I like the use of radix-ui in here! I guess the next step for this is to hook it up to an intersection observer or something to auto-collapse on margin content? |
6f78f60
to
d64e695
Compare
🦋 Changeset detectedLatest commit: f539088 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I've done some general refactoring work here too, which touches a reasonable amount of this code. I'm growing in my comfort with React perf specifics, so I might have made a regression here. Would reviewers be able to try this out with that in mind? |
getHeaders(selector).forEach((h) => { | ||
h.classList.remove(HIGHLIGHT_CLASS); | ||
}); | ||
el.classList.add(HIGHLIGHT_CLASS); | ||
highlight?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this in favour of letting the intersection observer handle it. Wouldn't be surprised if this was a specific bugfix -- I didn't check the blame.
@@ -75,7 +76,7 @@ export const ArticlePage = React.memo(function ({ | |||
const tree = copyNode(article.mdast); | |||
const keywords = article.frontmatter?.keywords ?? []; | |||
const parts = extractKnownParts(tree); | |||
|
|||
const isOutlineMargin = useMediaQuery('(min-width: 1024px)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice not to need this, but I think it's the cleanest approach.
Could you add a GIF of what this looks like to the top comment? I can't figure out how to build previews locally and we don't have a PR-based preview available, so it's hard to know what the UX is like. |
@choldgraf done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me from an end functionality perspective! As long as we aren't introducing any bugs or weird edge case regressions I'd be +1 on merging if somebody gives a +1 on the tech implementation
@stevejpurves I think the total set of class names that intersect with the margin is:
Based upon https://jupyter-book.github.io/myst-theme/?path=/docs/components-grid-system--docs. Do you agree? |
@agoose77 if you don't include col-screen, col-page, col-page-inset and col-body-outset could, for example, a full width figure spanning out from the main body content use one of those or is it expected that col-page-inset-right, col-body-outset-right would cover those cases? |
…se' into feat/outline-collapse
-- @agoose77
2024-08-21.17-18-17.mp4
Fixes #170